/*
 * @Author: myw
 * @Email: 516378746@qq.com
 * @Date: 2020-03-05 15:59:02
 * @Descripttion: 
 */
import { Directive } from '@angular/core';
import { ValidatorFn, AbstractControl } from '@angular/forms';

@Directive({
    selector: '[appWarehouseareaValid]'
})
export class WarehouseareaValidDirective {

    constructor() { }

}

export function wareHouseAreaValidator(nameRe: RegExp): ValidatorFn {
    return (control: AbstractControl): { [key: string]: any } | null => {
        if (control.value != null) {
            const forbidden = nameRe.test(control.value);
            return forbidden ? null : { 'msgWhsAreaError': true };
        }
    };
}









